package cn.maydaymemory.maydaycore.message.util;

import java.io.UnsupportedEncodingException;

public class StringUtil {
    public static int getGBKLengthWithoutColorCode(String string) {
        int color = 0;
        for(int f = 0;f<string.length();f++){
            if(string.charAt(f)=='§')color++;
        }
        try {
            return string.getBytes("GBK").length-color*3;
        } catch (UnsupportedEncodingException ignore) {}
        return -1;
    }
}
